<?php
    $username="root";
    $password="";
    $hostname="localhost";

    //connection to the database
    $dbhandle=mysql_connect($hostname, $username, $password)
            or die("Unable to connect to MySQL");


    mysql_set_charset('utf8');

    //select a database to work with
    $selected=mysql_select_db("cms_sitbar", $dbhandle)
            or die("Could not select examples");

    //execute the SQL query and return records
    $result=mysql_query("SELECT * FROM posts ORDER BY ID DESC");

    //close the connection
    mysql_close($dbhandle);
?>




<?php include('header.php'); ?>

<div id="center">
    <h1>Web izrada - Blog</h1>
    <div class="hr">&nbsp;</div>
    <br>
    <br>
    <div id="bluepen_content">

        <? while($row=mysql_fetch_array($result)): ?>
                
                <h1><?=$row{'post_title'}?></h1>
                <p>Objavljeno dana: <?=date('d.m.Y', $row{'date_time'})?> u <?=date('H:i:s', $row{'date_time'})?>h</p>
                
                <?=$row{'content'}?>

            <? endwhile; ?>

    </div>	


</div>

<div class="clear">&nbsp;</div>


<div class="hr">&nbsp;</div>

<br />

<?php include('footer.php'); ?>